package org.linys.model.dict;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.linys.model.BaseModel;
import org.springframework.stereotype.Component;

/**
 * 地域城市
 * 
 * @author LYS
 * 
 */
@Component("City")
public class City extends BaseModel implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer cityID;
	private String cityCode;
	private String cityName;
	private Integer parentCityID;
	private Integer cityTypeID;
	
	private String cityTypeName;
	private Integer cityTypeLevel;
	
	private List<City> childrenCitys = new ArrayList<City>();

	public Integer getCityID() {
		return cityID;
	}

	public void setCityID(Integer cityID) {
		this.cityID = cityID;
	}

	public String getCityCode() {
		return cityCode;
	}

	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	}

	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	public Integer getParentCityID() {
		return parentCityID;
	}

	public void setParentCityID(Integer parentCityID) {
		this.parentCityID = parentCityID;
	}

	public Integer getCityTypeID() {
		return cityTypeID;
	}

	public void setCityTypeID(Integer cityTypeID) {
		this.cityTypeID = cityTypeID;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String toString() {
		String baseJSON = "{" + "\"id\":\"" + cityID + "\",\"text\":\""+ cityName + "\",\"state\":\"" + state+ "\",\"children\":[";
		String childrenJSON = "";
		for (City city : this.childrenCitys) {
			if ("".equals(childrenJSON)) {
				childrenJSON += city.toString();
			} else {
				childrenJSON += "," + city.toString();
			}
		}
		return baseJSON + childrenJSON + "]}";
	}

	public List<City> getChildrenCitys() {
		return childrenCitys;
	}

	public void setChildrenCitys(List<City> childrenCitys) {
		this.childrenCitys = childrenCitys;
	}


	public String getCityTypeName() {
		return cityTypeName;
	}

	public void setCityTypeName(String cityTypeName) {
		this.cityTypeName = cityTypeName;
	}

	public Integer getCityTypeLevel() {
		return cityTypeLevel;
	}

	public void setCityTypeLevel(Integer cityTypeLevel) {
		this.cityTypeLevel = cityTypeLevel;
	}



}
